package com.icehand.utils.arraylist;

import java.util.*;

/**
 *
 * Created by icehand on 2016/9/18.
 */
public class ArrayListUtils {
    public static String join(Collection<?> arr, String separator){
        StringBuffer str = new StringBuffer();
        boolean isFirst = true;
        for(Object item : arr){
            if(!isFirst){
                str.append(separator);
            }
            str.append(String.valueOf(item));
            isFirst = false;
        }
        return str.toString();
    }
    
    public static List<String> removeDuplicate(List<String> list){
    	HashSet<String> h = new HashSet<>(list);
		List<String> newList  = new ArrayList<>();
		newList.addAll(h);
    	return newList;
    }
}
